Skip to content

Fix Array interface (#10886)#11294

Closed
falsandtru wants to merge 1 commit into
microsoft:masterfrom
falsandtru:lib.d.ts/array
Closed

Fix Array interface (#10886)#11294
falsandtru wants to merge 1 commit into
microsoft:masterfrom
falsandtru:lib.d.ts/array

Conversation

@falsandtru

Copy link
Copy Markdown
Contributor

No description provided.

@RyanCavanaugh

Copy link
Copy Markdown
Member

What's the bug tracking this change?

@falsandtru

Copy link
Copy Markdown
Contributor Author

Fixes #10886

@falsandtru

Copy link
Copy Markdown
Contributor Author

Can someone review this?

@mhegazy

mhegazy commented Dec 30, 2016

Copy link
Copy Markdown
Contributor

sorry for the late reply. can you refresh this PR?

@falsandtru

Copy link
Copy Markdown
Contributor Author

done

@falsandtru

Copy link
Copy Markdown
Contributor Author

now updating

@falsandtru falsandtru left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10886 is not acceptable because of confusing with tuple types.

>regExpExecArrayValue.slice() : string[]
>regExpExecArrayValue.slice : (start?: number, end?: number) => string[]
>regExpExecArrayValue.slice() : RegExpExecArray
>regExpExecArrayValue.slice : (start?: number, end?: number) => RegExpExecArray

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong, must return string[]. It can avoid by overloading in RegExpExecArray and RegExpMatchArray.

>t.slice() : [number, string]
>t.slice : { (start?: number, end?: number): (string | number)[]; (): [number, string]; }
>t.slice : { (start?: number, end?: number): [number, string]; (): [number, string]; }
>t : [number, string]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong, concat and slice methods must not return this type when it is a tuple type. It cannot avoid.

@falsandtru

falsandtru commented Jan 19, 2017

Copy link
Copy Markdown
Contributor Author

improved. i tried to improve RegExp{Exec,Match}Array too,

interface RegExpMatchArray extends Array<string> {
    index?: number;
    input?: string;
    concat(): string[];
    slice(start?: 0): string[];
}

interface RegExpExecArray extends Array<string> {
    index: number;
    input: string;
    concat(): string[];
    slice(start?: 0): string[];
}

but i didn't complete that because it makes 637 errors. i cannot fix such a lot of errors.

@falsandtru

Copy link
Copy Markdown
Contributor Author

@mhegazy can you review before conflicting again?

@falsandtru

Copy link
Copy Markdown
Contributor Author

@mhegazy

@falsandtru

Copy link
Copy Markdown
Contributor Author

@RyanCavanaugh @ahejlsberg @DanielRosenwasser @sandersn @vladima @zhengbli @weswigham can you review instead of him?

@mhegazy

mhegazy commented May 23, 2017

Copy link
Copy Markdown
Contributor

Fixed by #12784

@mhegazy mhegazy closed this May 23, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants